#{extends 'main.html' /} 
#{set title:'Topicos' /}

<script type="text/javascript">
	function voltar(){
		window.open("@{Foruns.forum}","_top");
	}
</script>

#{cabecalho/}

#{erros/}

<form action="@{Foruns.cadastrarTopico()}" method="GET">
	<table align="center">
			<tr>
				<td colspan="2">
					Cadastrar Novo Topico
				</td>
			</tr>
			<tr>
				<td>
					Titulo do Topico: &nbsp;
				</td>
				<td>
					<input type="text" name="titulo" class="login-box-field" />
				</td>
			</tr>
			<tr>
				<td>
					<input type="hidden" name="idUsuario" value="${session.usuario}" class="login-box-field" />
				</td>
				<td>
					<input type="hidden" name="idForum" value="${session.idForum}" class="login-box-field" />
				</td>
			</tr>
			<tr>
				<td colspan="2">
					<input type="submit" value="Cadastrar"/>
					<input type="button" value="Voltar" onclick="voltar()"/>
				</td>
			</tr>
		
		</table>
</form>

<table width="100%" align="center">
		#{if !listaTopicos.empty}
			<caption class="legend1">
				Listagem de Usuarios
			</caption>
			<thead>
				<tr style="background-color: #336; color: #FFF; font-weight: bold; font-size: 0.8em;">
					<th width="10%" align="center"> 
						Titulo
					</th>
					<th width="10%" align="center"> 
						Data da Criacao
					</th>
					<th width="10%" align="center"> 
						Tema do Forum
					</th>
					<th width="10%" align="center"> 
						Autor
					</th>
				</tr>
			
				#{list items: listaTopicos, as:'topico'}
					<tr>
						<td align="center">
							 ${topico.titulo}
						</td>
						<td align="center">
							${topico.dataCriacao}
						</td>
						<td align="center">
							${topico.forum.tema}
						</td>
						<td align="center">
							${topico.autor.nome}
						</td>
					</tr>
				#{/list}
			#{/if}
		</thead>
</table>

#{rodape/}